home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
23
/
6
/
DISK2368.ZIP
/
ANSWERS
/
CH04_3.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-20
|
741b
|
32 lines
// Chapter 4 - Programming exercise 3
#include "iostream.h"
#include "stdio.h"
int get_volume(int length, int width = 2, int height);
main()
{
int x = 10, y = 12, z = 15;
cout << "Some box data is " << get_volume(x, y, z) << "\n";
cout << "Some box data is " << get_volume(x, y) << "\n";
cout << "Some box data is " << get_volume(x) << "\n";
cout << "Some box data is " << get_volume(x, 7) << "\n";
cout << "Some box data is " << get_volume(5, 5, 5) << "\n";
}
int get_volume(int length, int width, int height)
{
printf("%4d %4d %4d ", length, width, height);
return length * width * height;
}
// Result of execution
//
// (No result - errors)